<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .father {
            width: 400px;
            height: 400px;
            background-color: red;
            margin: 50px;
            position: relative;
            left: 120px;
            top: 100px;
            overflow-y: scroll;
        }

        .son {
            width: 100px;
            height: 1000px;
            background-color: yellow;
            position: absolute;
            right: 40px;
            top: 50px;
        }

        body {
            height: 2000px;
        }

        a {
            position: fixed;
            right: 0;
            bottom: 100px;
            display: none;
        }
    </style>
</head>

<body>
    <button>点击滑动滚动条</button>
    <div class="father">
        <div class="son"></div>
    </div>

    <a href="#">返回顶部</a>

    <script src="./index.js"></script>
</body>

</html>